package com.huilian.iotbox.data.enums;

import lombok.Getter;

/**
 * @author: 少凡
 * @Date 2018/7/21 11:53
 */
@Getter
public enum OrderItemStatusEnum {

    WAIT(0, "待付款"),
    SUCCESS(1, "支付成功"),
    CLOSE(2, "关闭"),
    CANCLE(3, "撤单"),
    REFUND(4, "退单"),
    FAIL(5,"失败"),
    PART_REFUND(6,"部分退款"),
    FULL_FERUND(7,"全额退款"),
    REFUNDING(8,"退款中"),
    REFUND_FAIL(9,"退款失败"),
    NEXT_DAY_REFUND(10,"隔天退款"),
    ;
    private Integer code;
    private String desc;

    OrderItemStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String formatDesc(Integer code){
        OrderItemStatusEnum[] values = OrderItemStatusEnum.values();
        String desc = null;
        for (int i = 0; i < values.length; i++) {
            if (values[i].code.compareTo(code) == 0){
                desc = values[i].desc;
                break;
            }
        }
        return desc;
    }
}
